<?

$check_me_authed = "NO_OK";

if(($jid = $_POST["radioview"]) || ($jid = $_POST["job_id_posted"]) ){

	$Db = new oracleDb;
  $Db->init($_SESSION["ORCL"],
             $_SESSION["OPASS"],
             $_SESSION["SID"],
             _NO_COMMENT);

	if ($Db->connect()) {

  	$srcDbHdr = "MST_WAREHOUSE";
    $srcDbDtl = "MST_WAREHOUSE";

		$_SESSION["jid"]  = $_POST["radioview"];
		$jobId            = &$_SESSION["jid"];

		/**
		* Fetch global header
		* And check the status if it is valid
		* where STATUS = _NOT_ACTIVE
		*
		*/
		$CFetchers->fetchLstDataHeader($Db,
                                   $jobId,
                                   $srcDbHdr,
                                   $nHeader,
                                   $lstHeader);

		if($lstHeader["STATUS"][0] == _NOT_ACTIVE ||
		   $lstHeader["STATUS"][0] == _CANCELED){

  		/**
  		* Init the header vars
  		*
  		*/
  		$_POST["trDateEnt"]     = date("d-m-Y",
  		                               strtotime($lstHeader["TR_DATE"][0]));

  		/**
  		* Init the detail
  		*
  		*/
  		$CFetchers->fetchLstDataDetail($Db,
                                     $jobId,
                                     $srcDbDtl,
                                     $nDetail,
                                     $lstDetail);

  		for($iRow = 0; $iRow < $nDetail; $iRow++){


  		}

  		/**
  		* Check if this tx isn't canceled
  		* YES: it is modify
  		* NO : Add new entry with this copy
  		*
  		*/
  		if($lstHeader["STATUS"][0] != _CANCELED){

  		  $_SESSION["modify_mode"]= "Y";
  		}else{

  		  $_SESSION["modify_mode"]= "N";
  		}

  		/**
  		* This is only to by pass
  		* the entry_detail precheck
  		*
  		*/
  		//$_POST["entry"]         = "byPass";
  		$_SESSION["init_num"]   = $nDetail;

  		$Db->dc();

  		require("entry_restore_me.php");

  	}else{

  	  $Misc->usrDieJs("Tx can't be modified, it has been approved");
  	}
	}else{

	  $Misc->usrDieJs(_DB_CONN_ERROR);
	}
}else{

	$Misc->usrDieJs("Error:Cant retrieved job_id");
}

?> 